//
//  ArticleTableViewCell.swift
//  LearnDemo
//
//  Created by 振轩 on 2018/4/8.
//  Copyright © 2018年 振轩. All rights reserved.
//

import UIKit

class ArticleTableViewCell: UITableViewCell {
    
    @IBOutlet weak var editImageView: UIImageView!
    

    
    @IBOutlet weak var titleLabel: TopLeftLabel!
    
    
   
    @IBOutlet weak var timeLabel: UILabel!
    
    
    @IBOutlet weak var collectionLabe: UILabel!
    
    @IBOutlet weak var viewCountLabel: UILabel!
    @IBOutlet weak var thumbImageView: UIImageView!
    var mode:articleSub?{
        didSet{
          
            titleLabel.text = mode?.title
            collectionLabe.text = "\(String(describing: mode!.collectNum))"
         
            viewCountLabel.text = "\(String(describing: mode!.viewNum))"
            
            thumbImageView.loadWebImage(withName: mode?.thumb, andIsOrgin: true)
        }
        
        
    }
    
    var modeA:ArticleMode?{
        
        didSet{
            
            titleLabel.text = modeA?.title
            //timeLabel.text = modeA?.addDate
            thumbImageView.loadWebImage(withName: modeA?.thumb, andIsOrgin: true)
            
            
            if (modeA?.isSelect)! {
                
                self.editImageView?.image = UIImage.init(named: "Select")
                
            }else{
                
                self.editImageView?.image = UIImage.init(named: "UnSelect")
                
            }
            
            collectionLabe.text = "\(String(describing: modeA!.collectNum))"
            
            viewCountLabel.text = "\(String(describing: modeA!.viewNum))"
        }
        
    }

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        
        
        
    }
    
    
    
    var deleStatue:Bool = false{
        didSet{
            
            if deleStatue {
                
                editImageView.isHidden = false
                if (modeA?.isSelect)! {
                    
                    self.editImageView?.image = UIImage.init(named: "Select")
                    
                }else{
                    
                    self.editImageView?.image = UIImage.init(named: "UnSelect")
                    
                }
            }else{
                
                
                self.editImageView.isHidden = true
            }
            
            
            
        }
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        
        // Configure the view for the selected state
    }
    
}
